package com.dfec.book.entity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dfec.book.util.BasePage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 借阅记录实体类
 *
 * @author tangrg
 * @email 1446232546@qq.com
 * @date 2025-06-2025/6/19 09:37:11
 */
@ApiModel(description = "借阅记录实体")
@TableName("borrow_record")
public class BorrowRecordEntity  extends BasePage {

    @ApiModelProperty(value = "记录ID（主键，自增）", example = "10001")
    @TableId
    private Integer recordId;

    @ApiModelProperty(value = "图书ID", example = "1001", required = true)
    private Integer bookId;

    @ApiModelProperty(value = "借阅人姓名", example = "张三", required = true)
    private String borrower;

    @ApiModelProperty(value = "借出日期", example = "2023-05-0110:30:00")
    private LocalDateTime borrowDate;

    @ApiModelProperty(value = "归还日期", example = "2023-05-15T14:00:00")
    private LocalDateTime returnDate;

    @ApiModelProperty(value = "理论归还日期", example = "2023-05-15T14:00:00")
    @TableField(exist = false)
    private LocalDateTime oughtReturnDate;

    @ApiModelProperty(value = "联系方式", example = "13800138000", required = true)
    private String phone;

    @ApiModelProperty(value = "图书详细信息")
    @TableField(exist = false)
    private BookEntity book;

//    @ApiModelProperty(value = "图书ID列表")
//    @TableField(exist = false)
//    private List<Integer> bookIds;


    @ApiModelProperty(value = "归还状态:0 归还 1 未还", example = "0")
    @TableField(exist = false)
    private Integer returnStatus;

    @ApiModelProperty(value = "图书名称", example = "《Java 语言程序设计》")
    @TableField(exist = false)
    private String bookName;

    public BorrowRecordEntity() {
        this.borrowDate = LocalDateTime.now();
    }

    public BorrowRecordEntity(Integer bookId, String borrower, String phone) {
        this.bookId = bookId;
        this.borrower = borrower;
        this.phone = phone;
        this.borrowDate = LocalDateTime.now();
    }

    // Getter和Setter方法
    public Integer getRecordId() {
        return recordId;
    }

    public void setRecordId(Integer recordId) {
        this.recordId = recordId;
    }

    public Integer getBookId() {
        return bookId;
    }

    public void setBookId(Integer bookId) {
        this.bookId = bookId;
    }

    public String getBorrower() {
        return borrower;
    }

    public void setBorrower(String borrower) {
        this.borrower = borrower;
    }

    public LocalDateTime getBorrowDate() {
        return borrowDate;
    }

    public void setBorrowDate(LocalDateTime borrowDate) {
        this.borrowDate = borrowDate;
    }

    public LocalDateTime getReturnDate() {
        return returnDate;
    }

    public void setReturnDate(LocalDateTime returnDate) {
        this.returnDate = returnDate;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public BookEntity getBook() {
        return book;
    }

    public void setBook(BookEntity book) {
        this.book = book;
    }

//    public List<Integer> getBookIds() {
//        return bookIds;
//    }
//
//    public void setBookIds(List<Integer> bookIds) {
//        this.bookIds = bookIds;
//    }


    public Integer getReturnStatus() {
        return returnStatus;
    }

    public void setReturnStatus(Integer returnStatus) {
        this.returnStatus = returnStatus;
    }

    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }

    public LocalDateTime getOughtReturnDate() {
        return oughtReturnDate;
    }

    public void setOughtReturnDate(LocalDateTime oughtReturnDate) {
        this.oughtReturnDate = oughtReturnDate;
    }

    @Override
    public String toString() {
        return "BorrowRecordEntity{" +
                "recordId=" + recordId +
                ", bookId=" + bookId +
                ", borrower='" + borrower + '\'' +
                ", borrowDate=" + borrowDate +
                ", returnDate=" + returnDate +
                ", phone='" + phone + '\'' +
                '}';
    }
}